#ifndef __JSON_H__
#define __JSON_H__

#include "JSONContentListener.h"

class String;
/**
* Very simple JSON parser implementation
*/
class JsonParser{
private:
	char currentTag_[JSON_ITEM_LENGTH];
	char currentValue_[JSON_ITEM_LENGTH];
	int currentReadPos_;

	enum State {
		READY,
		NEXT_OR_END,
		READING,
		NAME,
		COLON,
		BEGIN_VALUE,
		VALUE,
		END
	};
	State state_;
	JsonContentListener& listener_;
	
	bool parserMachine(char c);
	void reset();
public:
	JsonParser(JsonContentListener& l);
	void parse(const String& msg);
};

#endif